import { defineStore } from "pinia";

const useLoadingStore = defineStore("loading", {
  state: () => ({
    isLoading: false,
    loadingText: "加载中..."
  }),
  actions: {
    show(text) {
      this.isLoading = true;
      if (text) this.loadingText = text;
    },
    hide() {
      this.isLoading = false;
    }
  }
});

export default useLoadingStore;
